﻿using LxBasic;

namespace LxCore
{
    public static class ResHelper
    {
        private static LxSim Sim => LxSim.Sim;
        #region Mesh
        public static FvZone? GetZone(string name)
        {
            return Sim.Mesh.Zones[name];
        }
        public static FvBound? GetBound(FvZone inZone, string name)
        {
            return inZone.Bounds[name];
        }
        public static FvJoint? GetJoint(string name)
        {
            return Sim.Mesh.Joints[name];
        }
        #endregion

        #region MeshCond
        public static ZoneCond? GetCond(FvZone zone)
        {
            return zone == null ? null : Sim.Conditions.ZoneConds[zone.ID];
        }
        public static InnerCond? GetCond(FvInner inner)
        {
            return inner == null ? null : Sim.Conditions.ZoneConds[inner.InZone.ID].InnerCond;
        }
        public static JointCond? GetCond(FvJoint joint)
        {
            return joint == null ? null : Sim.Conditions.JointConds[joint.ID];
        }
        public static BoundCond? GetCond(FvBound bound)
        {
            return bound == null ? null : Sim.Conditions.ZoneConds[bound.InZone.ID].BoundConds[bound.ID];
        }
        #endregion
        #region MeshField
        public static ZoneCFDFields? GetField(FvZone zone)
        {
            return zone == null ? null : Sim.Fields.ZoneFields[zone.ID];
        }
        public static ZoneCFDFields? GetField(FvBound bound)
        {
            return bound == null ? null : GetField(bound.InZone);
        }
        public static ZoneCFDFields? GetField(FvInner inner)
        {
            return inner == null ? null : GetField(inner.InZone);
        }
        public static JointCFDFields? GetField(FvJoint joint)
        {
            return joint == null ? null : Sim.Fields.JointFields[joint.ID];
        }
        #endregion
    }
}
